<style>
    .tenant-list-display-inline-block > div {
        display: inline-block;
        margin-right: 10px;
    }

    .ico-more {
        position: relative;
    }

    .ico-more:hover .top-userinfo-menu {
        display: block;
    }

    .ico-more .top-userinfo-menu {
        top: 8px;
    }

    .ico-more .top-userinfo-menu-list {
        z-index: 1;
    }

    .ico-more .top-userinfo-menu-list a:hover, .add-org .top-userinfo-menu-list a:hover {
        color: #ffa10f;
        background-color: #fff;
    }

    .top-userinfo-menu-arrow {
        display: block;
        position: absolute;
        top: 0;
        z-index: 2;
        width: 10px;
        height: 7px;
        margin-left: -5px;
    }

    .a-dropdown {
        font-size: 20px;
        line-height: 12px;
        height: 12px;
        display: block;
        text-align: left;
    }

    .attention-line {
        position: absolute;
        top: 0;
        left: 0;
        width: 0;
        height: 0;
        border-right: 12px solid transparent;
        border-top: 12px solid #ff5c50;
        border-left: 0px solid transparent;
    }

    .attention-line.test {
        border-top: 12px solid #58C8AD;
    }

</style>
<div>
    <div class="table-header clearfix ng-scope">
        <span class="fl lh30 f14">租户列表</span>

        <div class="ml20 fl btn-group"
             ng-if="userAuthList.indexOf('1000') !== -1">
            <input class="input-text fl" style="width: 200px;" type="text"
                   placeholder="企业名称/企业号" ng-model="query.keyword" ng-enter="query.execute(1)"/>
            <a class="btn" href="javascript: void(0)" ng-click="query.execute(1)">搜索</a>
        </div>
        <span class="fl lh30 f14 ml20">租户类型: </span>
        <div class="fl ml20" style="width: 60px;">
            <div class="clearfix radio-list"
                 ui-combobox
                 data="tenantType"
                 text-field="text"
                 value-field="value"
                 ng-change="query.execute(1)"
                 ng-model="query.isTest">
            </div>
        </div>
        <span class="fl lh30 f14 ml20">租户状态: </span>
        <div class="fl ml20" style="width: 60px;">
            <div class="clearfix radio-list"
                 ui-combobox
                 data="tenantStatus"
                 text-field="text"
                 value-field="value"
                 ng-change="query.execute(1)"
                 ng-model="query.orgStatus">
            </div>
        </div>
        <div class="fr btn-group"
             ng-if="userAuthList.indexOf('1001') !== -1">
            <a class="btn"
               href="javascript: void(0)"
               ui-dialog="新增租户"
               ui-dialog-before-show="getRDSDataInstanceList($data, $dialogScope)"
               ui-dialog-ok="createOrganization($data, $dialog, $dialogScope)"
               ui-dialog-url="${require('./dialog/create_tenant.html?url')}">新增</a>
            <a class="btn"
               href="javascript: void(0)"
               ng-if="false"
               ui-dialog="修改400密码"
               ui-dialog-ok="passwd($data, $dialog, $dialogScope)"
               ui-dialog-url="${require('./dialog/update_all_400_pwd.html?url')}">修改400密码</a>
            <a class="btn"
               href="javascript: void(0)"
               ui-dialog="管理400账号"
               ui-dialog-before-show="beforeShowManagerAcount($dialogScope)"
               ui-dialog-ok="saveManagerAcount($dialogScope)"
               ui-dialog-template="{{ relateRoleTemplateUrl }}">管理400账号</a>
        </div>
        <div class="fr" style="display: inline-block;margin: -4px 0 0 20px;">
            <input type="checkbox" ui-checkbox="只显示百强" ng-model="isBq">
        </div>
    </div>

    <div id="grid" class="table-responsive mt10" style="overflow-x: visible;">
        <table class="table table-hover">
            <thead>
            <tr>
                <th width="40" class="text-center">序号</th>
                <th width="100">企业名称</th>
                <th width="100">企业号</th>
                <th width="100">管理员邮箱</th>
                <th width="50">状态</th>
                <th width="85">创建时间</th>
                <th width="300">交付信息</th>
                <th width="200">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="item in list">
                <td class="text-center" style="position: relative;">
                    <div>
                        <i class="attention-line" title="百强租户" ng-if="item.isBq == '1'"></i>
                        <i class="attention-line test" title="测试租户" ng-if="item.isTest == '1'"></i>
                        {{$index + 1}}
                    </div>
                </td>
                <td>
                    <p class="tab-text-gray">{{item.FriendlyName}}
                    </p>
                </td>
                <td>
                    <p>{{item.UniqueName}}</p>
                </td>
                <td>
                    <p>{{item.Email}}</p>
                </td>
                <td>
                    <p>{{item.State==1?'已启用':'已禁用'}}</p>
                </td>
                <td>
                    <p>{{item.CreatedOn}}</p>
                </td>
                <td>
                    <p> 客户经理：{{item.CustomManager}} {{item.CustomManagerPhone}}</p>

                    <p> 交付顾问：{{item.Deliver}} {{item.DeliverPhone}}</p>
                </td>
                <td class="tenant-list-display-inline-block">
                    <div ng-if="userAuthList.indexOf('1001') !== -1">
                        <p>
                            <a class="tab-text"
                               href="javascript:void(0)"
                               ui-dialog="授权管理"
                               ui-dialog-show="showEditTenant(item,$dialog,$dialogScope)"
                               ui-dialog-cache="false"
                               ui-dialog-url="${require('./dialog/authorize.html?url')}">授权</a>
                        </p>

                        <p ng-if="item.isBq == '0'">
                            <a ng-click="setBq(item)">标识为百强</a>
                        </p>
                        <p ng-if="item.isBq == '1'">
                            <a ng-click="unsetBq(item)">取消百强标识</a>
                        </p>

                        <div>
                            <div class="ico-more">
                                <a href="javascript:;" class="a-dropdown">
                                    ...
                                </a>
                                <div class="top-userinfo-menu">
                                    <div class="top-userinfo-menu-list" style="text-align: center;">
                                        <p>
                                            <a class="tab-text"
                                               href="javascript: void(0)"
                                               ui-dialog="编辑租户"
                                               ui-dialog-before-show="boforeEditTenant($data, $dialogScope, item)"
                                               ui-dialog-ok="editOrganization($data, $dialog, $dialogScope)"
                                               ui-dialog-url="/tenant/dialog/edit_tenant.html">编辑</a>
                                        </p>
                                        <p>
                                            <a class="tab-text"
                                               href="javascript:void(0)"
                                               ui-dialog="交付信息"
                                               ui-dialog-cache="false"
                                               ui-dialog-data="item"
                                               ui-dialog-init="showDeliver($data, $dialog, $dialogScope)"
                                               ui-dialog-ok="saveDeliver($data,$dialog,$dialogScope)"
                                               ui-dialog-url="${require('./dialog/edit-org-delivery-info.html?url')}">设置交付信息</a>
                                        </p>
                                        <p>
                                            <a class="tab-text"
                                               href="javascript:void(0)"
                                               ui-dialog="短信充值"
                                               ui-dialog-before-show="beforeAddSmsQuota($data, item.Id)"
                                               ui-dialog-ok="addSmsQuota($data, item.Id)"
                                               ui-dialog-url="${require('./dialog/add_sms_quota.html?url')}">短信充值</a>
                                        </p>

                                        <p ng-show="item.State==0">
                                            <a class="tab-text"
                                               href="javascript:void(0)"
                                               ui-dialog="启用"
                                               ui-dialog-before-show="beforeEnabledDisabled($data, '启用')"
                                               ui-dialog-ok="enabledDisabled($data, item.Id, 1)"
                                               ui-dialog-url="${require('./dialog/enabled_disabled.html?url')}">启用</a>
                                        </p>
                                        <p ng-show="item.State==1">
                                            <a class="tab-text"
                                               href="javascript:void(0)"
                                               ui-dialog="禁用"
                                               ui-dialog-before-show="beforeEnabledDisabled($data, '禁用')"
                                               ui-dialog-ok="enabledDisabled($data, item.Id, 0)"
                                               ui-dialog-url="${require('./dialog/enabled_disabled.html?url')}">禁用</a>
                                        </p>
                                        <p>
                                            <a class="tab-text"
                                               href="javascript:void(0)"
                                               ui-dialog="重置管理员密码"
                                               ui-dialog-data="item"
                                               ui-dialog-ok="resetPwd($data, item.Id)"
                                               ui-dialog-url="${require('./dialog/reset_pwd.html?url')}">重置管理员密码</a>
                                        </p>
                                        <p ng-show="item.State==0">
                                            <a class="tab-text"
                                               href="javascript:void(0)"
                                               ui-dialog="删除"
                                               ui-dialog-before-show="beforeEnabledDisabled($data, '删除')"
                                               ui-dialog-ok="deleteOrganization($data, item.Id)"
                                               ui-dialog-url="${require('./dialog/enabled_disabled.html?url')}">删除</a>
                                        </p>
                                        <p>
                                            <a class="tab-text"
                                               ng-click="changeTenantType($data, item)">
                                                设置为{{item.isTest == '1' ? '正式' : '测试'}}租户
                                            </a>
                                        </p>
                                        <p ng-show="userAuthList.indexOf('1603') !== -1">
                                            <a class="tab-text"
                                               ui-dialog="{{+item.api_gate_is_authorize === 1 ? '编辑' : '开通'}}API网关"
                                               ui-dialog-before-show="beforeSetApiGate(item, $dialogScope, $data)"
                                               ui-dialog-url="${require('./dialog/set_api_gate.html?url')}">
                                                {{+item.api_gate_is_authorize === 1 ? '编辑' : '开通'}}API网关
                                            </a>
                                        </p>
                                    </div>
                                    <i class="top-userinfo-menu-arrow"></i>
                                </div>
                            </div>
                        </div>


                    </div>
                </td>
            </tr>
            </tbody>
        </table>

        <div ng-if="!list || list.length==0" class="no-data"><span>暂无数据</span></div>
    </div>

    <div ui-pagination page-index="query.page" page-size="query.pageSize" total="query.total"
         changed="query.execute($pageIndex)"></div>
</div>
